﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Userslib
{
    public class UserReg : User
    {
        new private String Race;
        public UserReg(String Name,int Accesslvl,String Race) : base (Name)
        {
            if (!ValidUser)
            {
                if (Races.isValidRace(Race))
                    this.Race = Race;
                else
                    throw new Exception("Invalid Race specified!");
                
                this.username = Name;
                this.accesslvl = Accesslvl;
            }
            else
                throw new Exception("Member already exists!");
        }

        public bool Register()
        {
            try
            {
                localhost.GetData D = new localhost.GetData();
                
                return true;// Con.InsertQ("INSERT INTO Members(Member_Name,Access_lvl,Race_ID) VALUES ('" + this.username + "'," + this.Accesslvl + ",(select Race_ID from Races where Race_Name='" + this.Race + "'))");
                
            }
            catch (Exception Exc)
            {
                throw Exc;
            }
        }
       
    }
}
